package com.zkw.ss.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Administrator on 2016/5/3 0003.
 * 绝对路径：response.sendRedirect("http://www.brainysoftware.com")发送http://www.brainysoftware.com
 根路径：response.sendRedirect("/ooo")发送至http://localhost:8080/ooo
 相对路径：response.sendRedirect("ooo")发送至http://localhost:8080/Test/ggg/ooo,
 */
@WebServlet(name = "redirect",urlPatterns = {"/redi"})
public class RedirectServlet extends HttpServlet{
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("RedirectServlet");
        resp.sendRedirect("index");
    }
}
